<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>查询所有宠物信息</title>
</head>
<style type="text/css">
    div{
        margin:  0px auto;
        width: 600px;
        position: relative;
        background-color: cadetblue;

    }
    th{
        color: #FFFFFF;
    }
    span{
        color: #FFFFFF;
        font-weight: bold;
    }
    a{
        text-decoration:none;
    }

</style>
<script type="text/javascript" src="Js/jquery-1.8.3(1).js"></script>
<script type="text/javascript">

</script>
<body>
<div align="center"><a href="addPet.jsp">新增宠物</a></div>
<div>
    <table width="600px" border="1">
        <tr>
            <th>宠物名称</th>
            <th>宠物品种</th>
            <th>宠物性别</th>
            <th>出生日期</th>
            <th>描述</th>
            <th>操作</th>
        </tr><c:forEach items="${petlist}" var="pet" varStatus="status">
        <tr <c:if test="${status.index%2==1}">style="background-color: rgb(219,241,212);"</c:if> >
        <td><a href="PetServlet?action=updatePet&petId=${pet.petId}" >${pet.petName}</a></td>
            <c:if test="${pet.petBreed eq 1}">
                <td>猫</td>
            </c:if>
            <c:if test="${pet.petBreed eq 2}">
                <td>鸟</td>
            </c:if>
            <c:if test="${pet.petBreed eq 3}">
                <td>兔</td>
            </c:if>
            <c:if test="${pet.petSex eq 1}">
            <td>公</td>
            </c:if>
            <c:if test="${pet.petSex eq 2}">
                <td>母</td>
            </c:if>
            <td><fmt:formatDate pattern="yyyy-MM-dd" value="${pet.birthday}"/></td>
            <td>${pet.description}</td>
            <td><a href="PetServlet?action=deletePet&petId=${pet.petId}" >删除</a></td>
        </tr></c:forEach>

    </table>
</div>
</body>
</html>
